feat: Add OpenAPI Support to oauth-apps.get API#36598
feat: Add OpenAPI Support to oauth-apps.get API#36598ggazzo merged 15 commits intoRocketChat:developfrom
Conversation
…lid-params]" in error
|
Looks like this PR is ready to merge! 🎉 |
🦋 Changeset detectedLatest commit: 9df5513 The changes in this PR will be included in the next version bump. This PR includes changesets to release 39 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| route: string; | ||
| response: Response; |
There was a problem hiding this comment.
It was missing in the typedThis, so I added it.
| active: boolean; | ||
| clientId: string; | ||
| clientSecret: string; | ||
| clientSecret?: string; |
There was a problem hiding this comment.
The IOAuthApps used in findOneAuthAppByIdOrClientId doesn’t include clientSecret, so I made it optional in the interface
There was a problem hiding this comment.
packages/models/src/models/OAuthApps.ts
findOneAuthAppByIdOrClientId(
props: { clientId: string } | { appId: string } | { _id: string },
options?: FindOptions<IOAuthApps>,
): Promise<IOAuthApps | null> {
return this.findOne(
{
...('_id' in props && { _id: props._id }),
...('appId' in props && { _id: props.appId }),
...('clientId' in props && { clientId: props.clientId }),
},
options,
);
}There was a problem hiding this comment.
Without this change, AJV would throw an error saying clientSecret is required, even though it's not returned
| expect(res.body).to.have.property('errorType', 'error-invalid-params'); | ||
| expect(res.body).to.have.property('error'); | ||
| expect(res.body.error).to.include('must be string').and.include('must match exactly one schema in oneOf [invalid-params]'); | ||
| expect(res.body.error).to.include('must be string').and.include('must match exactly one schema in oneOf'); |
There was a problem hiding this comment.
The error was must match exactly one schema in oneOf but didn’t include [invalid-params], so I added a separate assertion for errorType instead.
|
@cardoso Ready for review whenever you have time |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #36598 +/- ##
========================================
Coverage 65.65% 65.65%
========================================
Files 3197 3197
Lines 106812 106812
Branches 20332 20329 -3
========================================
+ Hits 70130 70131 +1
- Misses 34035 34038 +3
+ Partials 2647 2643 -4
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
https://rocketchat.atlassian.net/browse/ARCH-1734
Description:
This PR integrates OpenAPI support into the
Rocket.Chat API, migrate ofRocket.Chat APIendpoints to the new OpenAPI pattern. The update includes improved API documentation, enhanced type safety, and response validation using AJV.Key Changes:
Issue Reference:
Relates to #34983, part of the ongoing OpenAPI integration effort.
Testing:
Verified that the API response schemas are correctly documented in Swagger UI.
All tests passed without any breaking changes
Endpoints:
Get OAuth App
Looking forward to your feedback! 🚀